﻿function getUrlPortal() {    
    return URL_LCR;
    //return $('#urlPortal').val();
}

function setAutoAyuda(nameControl,pURL,hiddenControl) {

    $(nameControl).autocomplete({
        source: function (request, response) {
            $.ajax({
                url: pURL,
                type: "POST",
                dataType: "json",
                data: { wordSearch: request.term },
                success: function (data) {
                    response($.map(data, function (item) {
                        return { label: item.vNomTabla, value: item.vNomTabla, id: item.nIdeCompendio };
                    }))
                }
            })
        },
        minLength: 3,
        select: function (event, ui) {
            $(hiddenControl).val('');
            $(hiddenControl).val(ui.item.id);
        },
        open: function (event, ui) { $(hiddenControl).val(''); }
    });
}

function setAutoAyudaGen(nameCampo,nameId, pURL) {    
    $(nameCampo).autocomplete({
        source: function (request, response) {
            $.ajax({
                url: pURL,
                type: "POST",
                dataType: "json",
                data: { wordSearch: request.term },
                success: function (data) {
                    response($.map(data, function (item) {
                        return { value: item.descripcion, id: item.identificador };
                    }))
                }
            })
        },
        minLength: 3,
        select: function (event, ui) {
            $(nameId).val('');
            $(nameId).val(ui.item.id);
        },
        open: function (event, ui) { $(nameId).val(''); }
    });
}
function consultaSunat(objCampo) {
    var x = (screen.width) / 4;
    var y = (screen.height - 300) / 2;
    var pUrl = "http://www.sunat.gob.pe/cl-ti-itmrconsruc/jcrS00Alias";
    popupImp = window.open(pUrl, 'pop_sunat', "top=" + y + ",left=" + x + ",height=600,width=800,status=yes,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no");
    popupImp.focus();
}

function consultaEsSalud(objCampo) {
    var x = (screen.width) / 4;
    var y = (screen.height - 300) / 2;
    var pUrl = "http://ww4.essalud.gob.pe:7777/acredita/";
    popupImp = window.open(pUrl, 'pop_sunat', "top=" + y + ",left=" + x + ",height=600,width=800,status=yes,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no");
    popupImp.focus();
}

function consultaSis(objCampo) {
    var x = (screen.width) / 4;
    var y = (screen.height - 300) / 2;
    var pUrl = "http://app.sis.gob.pe/SisConsultaEnLinea/Consulta/frmConsultaEnLinea.aspx";
    popupImp = window.open(pUrl, 'pop_sunat', "top=" + y + ",left=" + x + ",height=600,width=800,status=yes,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no");
    popupImp.focus();
}
function consultaSisfoh(objCampo) {
    var x = (screen.width) / 4;
    var y = (screen.height - 300) / 2;
    var pUrl = "http://sisfoh-fse.sisfoh.gob.pe/PERSONAS/Buscar_personas_sisfoh.asp";
    popupImp = window.open(pUrl, 'pop_sunat', "top=" + y + ",left=" + x + ",height=600,width=800,status=yes,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no");
    popupImp.focus();
}